/******************************************************************************
* Copyright (C) 2010-2011 Computer Graphics Systems Group at the 
* Hasso-Plattner-Institute (HPI), Potsdam, Germany.
*
* Lecture : Geovisualisation Summer Term 2011
* Exercise: Processing Rendering OpenStreetMap Data 
*
* Author: sebastian.pasewaldt@hpi.uni-potsdam.de
*
******************************************************************************/

#ifndef INPUTEVENTHANDLER_H__
#define INPUTEVENTHANDLER_H__

//[-------------------------------------------------------]
//[ Includes                                              ]
//[-------------------------------------------------------]
#include <osgGA/GUIEventHandler>
#include <osg/ref_ptr>
#include "QtViewer.h"

#include <QObject>
#include "ToggleNode.h"

class QtModelViewer;

//[-------------------------------------------------------]
//[ Classes                                               ]
//[-------------------------------------------------------]

class InputEventHandler : public QObject, public osgGA::GUIEventHandler{

    Q_OBJECT

public:
	//[-------------------------------------------------------]
	//[ Public functions                                      ]
	//[-------------------------------------------------------]
	InputEventHandler(QtViewer* viewer);
      
	/**
	*  @brief
	*    handle keyboard and mouse events
	*/
	virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor*);

signals:
    void sendFeatureInfo(QString);
    void sendMarkerPosition(osg::Vec3*);

private:
    void highlightGeode(ToggleNode* geode);

	//[-------------------------------------------------------]
	//[ Private members	                                      ]
	//[-------------------------------------------------------]
private:
	QtViewer* m_viewer;
    osg::ref_ptr<ToggleNode> m_prevHighlightedGeode;
};
#endif // INPUTEVENTHANDLER_H__